-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[incubator-kie-drools-5818] [new-parser] Parsing fails if a Java keyw… #5958
[incubator-kie-drools-5818] [new-parser] Parsing fails if a Java keyw… #5958
Conversation
…ord appears in a qualified name
@Test | ||
public void testNoViableAlt() { | ||
String source = "x.int"; | ||
parser.parse(source); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because of this PR fix, this expression no longer causes an error. I couldn't figure out another expression to produce "no viable alternative", so removed this test for now. I think we can add the test later, but I think it's relatively low priority.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a~a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Added the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have to request a change. I don't have the time to investigate this fully but there is a problem with the new
keyword. It might need a special treatment because at this state the PR breaks org.drools.mvel.integrationtests.JittingTest#testBigDecimalConstructorCoercion
:
### parse : ANTLR4_PARSER_ENABLED = true
line 1:10 no viable alternative at input 'BigDecimal'
14:49:04.620 [main] ERROR o.d.c.k.b.impl.AbstractKieProject.buildKnowledgePackages:280 - Unable to build KieBaseModel:KieBaseModelName
Unable to parse pattern expression:
[ERR 101] Line 1:10 no viable alternative at input 'BigDecimal' : [Rule name='R1']
14:49:04.626 [main] ERROR o.d.testcoverage.common.util.KieUtil.getKieBuilderFromKieFileSystem:165 - KieBuilder errors: [Message [id=1, kieBase=KieBaseModelName, level=ERROR, path=rules1.drl, line=4, column=0
text=Unable to parse pattern expression:
[ERR 101] Line 1:10 no viable alternative at input 'BigDecimal']]
java.lang.AssertionError: [[Message [id=1, kieBase=KieBaseModelName, level=ERROR, path=rules1.drl, line=4, column=0
text=Unable to parse pattern expression:
[ERR 101] Line 1:10 no viable alternative at input 'BigDecimal']]]
Expecting empty but was: [Message [id=1, kieBase=KieBaseModelName, level=ERROR, path=rules1.drl, line=4, column=0
text=Unable to parse pattern expression:
[ERR 101] Line 1:10 no viable alternative at input 'BigDecimal']]
at org.drools.testcoverage.common.util.KieUtil.getKieBuilderFromKieFileSystem(KieUtil.java:169)
at org.drools.testcoverage.common.util.KieUtil.getKieBuilderFromKieFileSystem(KieUtil.java:134)
at org.drools.testcoverage.common.util.KieUtil.buildAndInstallKieModuleIntoRepo(KieUtil.java:78)
at org.drools.testcoverage.common.util.KieUtil.buildAndInstallKieModuleIntoRepo(KieUtil.java:72)
at org.drools.testcoverage.common.util.KieUtil.getKieModuleFromResources(KieUtil.java:249)
at org.drools.testcoverage.common.util.KieUtil.getKieModuleFromDrls(KieUtil.java:227)
at org.drools.testcoverage.common.util.KieUtil.getKieModuleFromDrls(KieUtil.java:217)
at org.drools.testcoverage.common.util.KieUtil.getKieModuleFromDrls(KieUtil.java:212)
at org.drools.mvel.integrationtests.JittingTest.testBigDecimalConstructorCoercion(JittingTest.java:327)
@Test | ||
public void testNoViableAlt() { | ||
String source = "x.int"; | ||
parser.parse(source); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a~a
Thanks @yurloc ! I excluded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM now.
@mariofusco @gitgabrio please review and merge, thanks! |
apache#5958) * [incubator-kie-drools-5818] [new-parser] Parsing fails if a Java keyword appears in a qualified name * - Exclude 'new' from 'drlIdentifier' because of 'primary' ambiguity - Add tests
…ord appears in a qualified name
Issue
org.kie.declarativetypes.JavaBeansEventRoleTest#testImportBean
org.drools.mvel.integrationtests.ExtendsTest#testDeclareExtendsWithFullyQualifiedName
are fixed
Also
[new-parser] no viable alternative at input
from return
#5917org.drools.mvel.integrationtests.ExtendsTest#testExtendsBasic
is fixed.
[new-parser] Rule named
default
(without quotes) cannot be parsed #5910org.drools.mvel.integrationtests.VarargsTest#testVarargs
is fixed